package com.sikao.app.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

import com.nostra13.universalimageloader.core.ImageLoader;
import com.sikao.app.R;
import com.sikao.app.bean.AuctionDetailBean;
import com.sikao.app.net.HttpApi;

import java.util.List;

/**
 * 拍卖里的质检报告
 */
public class InspectionReportForAuctionAdapter extends BaseAdapter {

	private Context context;
	//质检报告
	private List<AuctionDetailBean.ResBean.CheckReportInfoBean> check_report;
	public InspectionReportForAuctionAdapter(Context context, List<AuctionDetailBean.ResBean.CheckReportInfoBean> check_report){
		this.context = context;
		this.check_report=check_report;
	}
	@Override
	public int getCount() {
		return check_report.size();
	}

	@Override
	public Object getItem(int position) {
		return check_report.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		if(convertView==null) {
			convertView = View.inflate(context, R.layout.pictures_list_item, null);
			convertView.setTag(new ViewHolder(convertView));
		}
		initializeViews((AuctionDetailBean.ResBean.CheckReportInfoBean)getItem(position), (ViewHolder) convertView.getTag());
		return convertView;
	}

	private void initializeViews(AuctionDetailBean.ResBean.CheckReportInfoBean checkReportInfoBean, ViewHolder viewHolder) {

		ImageLoader.getInstance().displayImage(HttpApi.BANNERUTL+checkReportInfoBean.getUrl(),viewHolder.iv);//HttpApi.BANNERUTL+

	}
	public class ViewHolder {
		public final ImageView iv;
		public final View root;

		public ViewHolder(View root) {
			iv = (ImageView) root.findViewById(R.id.iv);
			this.root = root;
		}
	}
}
